﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

//  ToDo:
//      Allow selection of year to report.

namespace Northwind.NET.FE.Reports
{
    public partial class SalesTotalsByAmountReport1 : Form
    {
        private int _year;
        private decimal _amountMin;

        public SalesTotalsByAmountReport1()
        {
            InitializeComponent();
        }

        private void SalesTotalsByAmountReport_Load(object sender, EventArgs e)
        {
            // TODO: This line of code loads data into the 'simpleReportsDataSet.SalesTotalsByAmount' table. You can move, or remove it, as needed.
            //this.salesTotalsByAmountTableAdapter.FillByYearAmountMin(this.simpleReportsDataSet.SalesTotalsByAmount);
            SetDefaultValues();
            RefreshReport();
        }

        private void SalesTotalsByAmountReport_FormClosed(object sender, FormClosedEventArgs e)
        {
            Northwind.NET.FE.Globals.Navigator.UnhideMainSwitchboard();
        }

        private void SetDefaultValues()
        {
            _amountMin = 2500;
            _year = 1997;
        }

        private void RefreshReport()
        {
            this.salesTotalsByAmountTableAdapter.FillByYearAmountMin(
                this.simpleReportsDataSet.SalesTotalsByAmount, _year, _amountMin);
            this.reportViewer1.RefreshReport();
        }
    }
}
